//Zhuk Artsem, 399

#include <iostream>
#include "dist.h"
#include <vector>
#include <string>

using namespace std;

void applyReciepeToGetToFromFrom(const vector<string> &from, const vector<string> &to, const vector<int> &recipe){
	int i = 0, j = 0;
	for (auto action:recipe){
		if (action == 0){
			cout << " " << from[i] << "\n";
			i++, j++;
		}
		if (action == -1){
			cout << "-" << from[i] << "\n";
			++i;
		}
		if (action == 1){
			cout << "+" << to[j] << "\n";
			++j;
		}
	}
}

vector<string> readFile(char * file){
	ifstream input(file);
	vector<string> content;
	string str;
	
	while (getline(input, str, '\n')){
		content.push_back(str);
	}
	return content;
}


void printDiff(char * file1, char * file2){
	string str;
	vector<string> v1 = readFile(file1);
	vector<string> v2 = readFile(file2);
	
	applyReciepeToGetToFromFrom(v1, v2, DistanceFounder::diff(v1, v2));
}

int main(int argc, char ** argv){
	printDiff(argv[1],argv[2]);
	return 0;
}
